package com.crm.service.impl.sys.permissionManagement;

import com.crm.dao.mapper.customMapper.sys.InvoiceCompanyCustomMapper;
import com.crm.dao.mapper.sys.permissionManagement.SysInvoiceCompanyMapper;
import com.crm.model.entity.sys.permissionManagement.SysInvoiceCompany;
import com.crm.model.vo.sys.InvoiceCompanyVO;
import com.crm.service.sys.permissionManagement.InvoiceCompanyDbService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author:chaifuyou
 * @Date: 2021/7/23 8:44
 */
@Service
public class InvoiceCompanyDbServiceImpl implements InvoiceCompanyDbService {

    @Autowired
    private SysInvoiceCompanyMapper sysInvoiceCompanyMapper;

    @Autowired
    private InvoiceCompanyCustomMapper invoiceCompanyCustomMapper;

    /**
     * 新增开票公司
     * @param sysInvoiceCompany
     */
    @Override
    public void addCompanyIssueInvoice(SysInvoiceCompany sysInvoiceCompany) {
        sysInvoiceCompanyMapper.insertSelective(sysInvoiceCompany);
    }

    /**
     * 查询开票公司列表
     * @param companyName
     * @return
     */
    @Override
    public List<InvoiceCompanyVO> selectInvoiceCompanyList(String companyName,Integer companyStatus) {
        return invoiceCompanyCustomMapper.selectInvoiceCompanyList(companyName,companyStatus);
    }

    /**
     * 删除开票公司
     * @param companyId
     */
    @Override
    public void delInvoiceCompany(String companyId) {
        invoiceCompanyCustomMapper.delInvoiceCompany(companyId);
    }

    /**
     * 停用开票公司
     * @param companyId
     */
    @Override
    public void stopInvoiceCompany(String companyId,Integer type) {
        invoiceCompanyCustomMapper.stopInvoiceCompany(companyId,type);
    }

    /**
     * 根据分公司查询开票公司列表
     * @param companyId
     * @return
     */
    @Override
    public List<InvoiceCompanyVO> selectCompanyInvoiceCompany(String companyId) {
        return invoiceCompanyCustomMapper.selectCompanyInvoiceCompany(companyId);
    }

    /**
     * 通过开票申请id查询开票公司信息
     * @param chsCustomerOrderInvoiceId
     * @return
     */
    @Override
    public InvoiceCompanyVO selectInvoiceCompanyByInvoiceId(String chsCustomerOrderInvoiceId) {
        return invoiceCompanyCustomMapper.selectInvoiceCompanyByInvoiceId(chsCustomerOrderInvoiceId);
    }
}
